package org.vectrics.user;

import org.apache.commons.lang.builder.EqualsBuilder;

public class Person {
	
    private String cuilOrCuit;
    private String firstName = null;
    private String lastName = null;
    private String middleName;
	
    public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public String getMiddleName() {
		return middleName;
	}

	public String getCuilOrCuit() {
		return cuilOrCuit;
	}
	
	public void setMiddleName(String middleName) {
		this.middleName = middleName;
	}
	
	public void setCuilOrCuit(String cuilOrCuit) {
		this.cuilOrCuit = cuilOrCuit;
	}
	
	public String getFullName() {
		String fullName = "";
		
		if (this.firstName != null) {
			if (fullName.length() > 0) {
				fullName += " ";
			}
			fullName += this.firstName;
		}
		if (this.middleName != null) {
			fullName += " " + this.middleName;
		}
		if (this.lastName != null) {
			fullName += " " + this.lastName;
		}
		return (fullName);
	}

	public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (!obj.getClass().isAssignableFrom(getClass())) {
            return false;
        }
        Person otherPerson = (Person) obj;
        return new EqualsBuilder().append(this.getFullName(), otherPerson.getFullName()).append(this.getCuilOrCuit(),
                otherPerson.getCuilOrCuit()).isEquals();
    }
    
}
